<?php

class Application_Form_CustomerEdit extends Zend_Form
{

	public function init()
	{
		$managementUnitDb = new Application_Model_ManagementUnitMapper();
		$salesrepDb = new Application_Model_SalesrepMapper();
		
		$this->setMethod('post');
		$this->setAction('edit');


		$partyNumber = new Zend_Form_Element_Hidden('partyNumber');
		
		$customerName = new Zend_Form_Element_Text('customerName');
		$customerName->setLabel('Customer Name');
		$customerName->setAttrib('readonly', 'readonly');
		$customerName->setAttrib('size', '40');
		
		$managementUnit = new Zend_Form_Element_Select('managementUnit');
		$managementUnit->setMultiOptions($managementUnitDb->getAll('form'));
		$managementUnit->setLabel('ManagementUnit');
		$managementUnit->setRequired(true);
		
		$salesrep = new Zend_Form_Element_Select('salesRepId');
		$salesrep->setMultiOptions($salesrepDb->getAll('form'));
		$salesrep->setLabel('Sales Rep Name');
		$salesrep->setRequired(true);
		
		$campaignPermission = new Zend_Form_Element_Select('campaignPermission');
		$campaignPermission->setLabel('Customer allowed for campaigns');
		$campaignPermission->setRequired(true);
		$campaignPermission->setMultiOptions(array('N' => 'not allowed', 'Y' => 'allowed'));
		
		$rmaPermission = new Zend_Form_Element_Select('rmaPermission');
		$rmaPermission->setLabel('Customer allowed for returns');
		$rmaPermission->setRequired(true);
		$rmaPermission->setMultiOptions(array('N' => 'not allowed', 'Y' => 'allowed'));
		
		$submit = new Zend_Form_Element_Submit('Add');
		$submit->setLabel('Submit changes');
		
		$this->addElements(array($customerName, $partyNumber, $managementUnit, $salesrep, $campaignPermission, $rmaPermission, $submit));
	}


}

